package il.ac.tau.cvws.scrabblesidekick.server.engine.storage;

import java.util.concurrent.atomic.AtomicLong;

import il.ac.tau.cvws.scrabblesidekick.shared.datatype.StorageDataKey;

/* Generates unique storage keys.
 * These keys are used to store calibration data, and are sent back to devices
 * when the calibration succeeds.
 */
public class StorageKeyGenerator
{
	private static AtomicLong currentKey;
	
	public static void init()
	{
		currentKey = new AtomicLong(System.currentTimeMillis());
	}
	
	public static StorageDataKey generateStorageKey()
	{
		currentKey.incrementAndGet();
		
		return new StorageDataKey(currentKey.get());
	}
}
